import request from './../utils/request.js';

/**
 * 公共接口
 *
 */

export function getUserInfo(id = "") {
  return request.get('member/detail', {id: id});
}

export function getSimpleInfo() {
  return request.get('member/simple', {});
}


export function getMyStat(data) {
  return request.get('member/my_stat', data);
}

//地址列表
export function getAddressList(data) {
  return request.get('address/list', data);
}

//地址列表
export function getMyAddressList(data) {
  return request.get('address/my', data);
}


/**
 * 初始化数据
 * @param id
 * @returns {*}
 */
export function getMyData(data) {
  return request.get('member/init', data || {});
}

export function getAddressDetail(id) {
  return request.get('address/detail', {id: id});
}

export function getDeliverInitData(data) {
  return request.get('member/deliver_init', data || {});
}

/**
 * 检测是否有配送功能
 * @returns {*}
 */
export function checkDeliver() {
  return request.get('member/check_deliver', {is_shop: 1});
}

/**
 * 新增、编辑地址
 * @param string uni
 */
export function editAddress(data) {
  return request.post('address/edit', data);
}

/**
 * 新增、编辑地址
 * @param string uni
 */
export function delAddress(data) {
  return request.post('address/delete', data);
}

/**
 * 设置默认值
 * @param string uni
 */
export function setAddressDefault(id) {
  return request.post('address/set_default', {id: id});
}

// 编辑单个字段
export function updateMemberField(data) {
  return request.post('member/update_field', data || {});
}

/**
 * 更新标签
 * @param string uni
 */
export function updateTag(tagId) {
  return request.post('member/update_tag', {tagId: tagId});
}
export function updateMemberPark(data) {
  return request.post('member/update_park', data || {});
}

